"""
数据模型
这里定义接收数据和响应数据的模型
"""
from datetime import datetime
from typing import  Optional, List

from pydantic import BaseModel, Field


class DeptBase(BaseModel):
    name: str
    local: str

class DpetIn(DeptBase):
    pass

class DeptOut(DeptBase):
    pass

class EmployeeBase(BaseModel):
    name:str
    age:int = 18
    email:Optional[str] = None
    dept_id:int


class EmployeeInt(EmployeeBase):
    created: datetime = Field(default_factory=datetime.now)


class EmployeeOut(EmployeeBase):
    pass

# 分页
class PaginatedResponse(BaseModel):
    total: int # 总数据条数
    page: int # 页码
    page_size: int # 每页显示多少条数据
    total_pages: int  # 总页数
    data: List # 具体数据
